//
//  ByBasketBallHandle.m
//  caipiao_ios
//
//  Created by mc on 2018/9/6.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByBasketBallHandle.h"
#import "JSONKit.h"


@implementation ByBasketBallHandle

//构造篮球投注
+ (NSMutableDictionary *)getBasketBallNumWithSelectedData:(NSMutableArray *)dataArray WithType:(NSInteger)type{
    
    NSMutableDictionary *numDic = [NSMutableDictionary dictionary];
    for (ByNetModel *netModel in dataArray) {
        NSString *key = [NSString stringWithFormat:@"%@%@",netModel.netModel.timeString,netModel.netModel.num_type];
        NSLog(@"key = %@", key);
        key =  [key stringByReplacingOccurrencesOfString:@"-" withString:@""];
        NSMutableDictionary *valueDic = [NSMutableDictionary dictionary];
        if (netModel.sfSelectedArray.count > 0) {
            NSMutableDictionary *sfDic = [self getBasketBall3001Or3002ValueWithArray:netModel.sfSelectedArray];
            [valueDic setObject:sfDic forKey:@"3001"];
        }
        
        if (netModel.rsfSelectedArray.count > 0) {
            NSMutableDictionary *sfcDic = [self getBasketBall3001Or3002ValueWithArray:netModel.rsfSelectedArray];
            [valueDic setObject:sfcDic forKey:@"3002"];
        }
        
        if (netModel.bigSmallSelectedArray.count > 0) {
            NSMutableDictionary *bigSmallDic = [self getBasketBall3004ValueWith:netModel.bigSmallSelectedArray];
            [valueDic setObject:bigSmallDic forKey:@"3004"];
        }
        
        if (netModel.sfcSelectedArray.count > 0) {
            NSMutableDictionary *sfcDic = [self getBasketBall3003ValueWith:netModel.sfcSelectedArray];
            [valueDic setObject:sfcDic forKey:@"3003"];
        }
        [numDic setObject:valueDic forKey:key];
    }
    return numDic;
}

//胜负或者让胜负
+ (NSMutableDictionary *)getBasketBall3001Or3002ValueWithArray:(NSArray *)dataArray{
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    for (ByNetModel *netModel in dataArray) {
        [dic setObject:netModel.single forKey:@"single"];
        [dic setObject:netModel.valueString forKey:netModel.numKey];
        
    }
    return dic;
}

//胜负差
+ (NSMutableDictionary *)getBasketBall3003ValueWith:(NSArray *)dataArray{
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    for (ByNetModel *netModel in dataArray) {
        [dic setObject:netModel.single forKey:@"single"];
        [dic setObject:netModel.valueString forKey:netModel.numKey];
        
    }
    return dic;
}
//预估总分
+ (NSMutableDictionary *)getBasketBall3004ValueWith:(NSArray *)dataArray{
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    for (ByNetModel *netModel in dataArray) {
        [dic setObject:netModel.single forKey:@"single"];
        [dic setObject:netModel.fixedodds forKey:@"score"];
        [dic setObject:netModel.valueString forKey:netModel.numKey];
        
    }
    return dic;
}

//构建数据 胜负
+ (NSMutableArray *)getFinalSfDataWithDic:(NSDictionary *)dic WithOtherModel:(ByNetModel *)otherModel{
    
    NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
    for (NSInteger i = 0; i < 2; i++) {
        ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
        netModel.selected = NO;
        netModel.play_type = @"3001";
        netModel.single = otherModel.single;
        if (i == 0) {
            netModel.title = @"主胜";
            netModel.numKey = @"3";
            netModel.valueString = otherModel.h;
            
        }else if (i == 1){
            
            netModel.title = @"客胜";
            netModel.numKey = @"0";
            netModel.valueString = otherModel.a;
        }
        [dataArray addObject:netModel];
    }
    return dataArray;
}

//让分胜负
+ (NSMutableArray *)getFinalRsfDataWithDic:(NSDictionary *)dic WithOtherModel:(ByNetModel *)otherModel{
    
    NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
    for (NSInteger i = 0; i < 2; i++) {
        ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
        netModel.selected = NO;
        netModel.play_type = @"3002";
        netModel.single = otherModel.single;
        netModel.fixedodds = otherModel.fixedodds;
        if (i == 0) {
            netModel.title = @"主胜";
            netModel.numKey = @"3";
            netModel.valueString = otherModel.h;
        }else if (i == 1){
            netModel.title = @"客胜";
            netModel.numKey = @"0";
            netModel.valueString = otherModel.a;
        }
        [dataArray addObject:netModel];
    }
    return dataArray;
}
//大小分
+ (NSMutableArray *)getFinalBigSmallDataWithDic:(NSDictionary *)dic WithOtherModel:(ByNetModel *)otherModel{
    
    NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
    for (NSInteger i = 0; i < 2; i++) {
        ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
        netModel.selected = NO;
        netModel.play_type = @"3004";
        netModel.single = otherModel.single;
        netModel.fixedodds = otherModel.fixedodds;
        if (i == 0) {
            netModel.title = @"大分";
            netModel.numKey = @"1";
            netModel.valueString = otherModel.h;
            
        }else if (i == 1){
            
            netModel.title = @"小分";
            netModel.numKey = @"0";
            netModel.valueString = otherModel.l;
        }
        [dataArray addObject:netModel];
    }
    return dataArray;
}

+ (NSMutableArray *)getFinalSfcDataWithDic:(NSDictionary *)dic WithOtherModel:(ByNetModel *)otherModel{
    
    NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
    for (NSInteger i = 0; i < 12; i++) {
        ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
        netModel.selected = NO;
        netModel.play_type = @"3003";
        netModel.single = otherModel.single;
        if (i == 0) {
            netModel.title = @"1-5";
            netModel.numKey = @"w1";
            netModel.valueString = otherModel.w1;
            
        }else if (i == 1){
            
            netModel.title = @"6-10";
            netModel.numKey = @"w2";
            netModel.valueString = otherModel.w2;
            
        }else if (i == 2){
            
            netModel.title = @"11-15";
            netModel.numKey = @"w3";
            netModel.valueString = otherModel.w3;
            
        }else if (i == 3){
            
            netModel.title = @"16-20";
            netModel.numKey = @"w4";
            netModel.valueString = otherModel.w4;
            
        }else if (i == 4){
            
            netModel.title = @"21-25";
            netModel.numKey = @"w5";
            netModel.valueString = otherModel.w5;
            
        }else if (i == 5){
            
            netModel.title = @"26+";
            netModel.numKey = @"w6";
            netModel.valueString = otherModel.w6;
        }else if (i == 6) {
            netModel.title = @"1-5";
            netModel.numKey = @"l1";
            netModel.valueString = otherModel.l1;
            
        }else if (i == 7){
            
            netModel.title = @"6-10";
            netModel.numKey = @"l2";
            netModel.valueString = otherModel.l2;
            
        }else if (i == 8){
            
            netModel.title = @"11-15";
            netModel.numKey = @"l3";
            netModel.valueString = otherModel.l3;
            
        }else if (i == 9){
            
            netModel.title = @"16-20";
            netModel.numKey = @"l4";
            netModel.valueString = otherModel.l4;
            
        }else if (i == 10){
            
            netModel.title = @"21-25";
            netModel.numKey = @"l5";
            netModel.valueString = otherModel.l5;
            
        }else if (i == 11){
            
            netModel.title = @"26+";
            netModel.numKey = @"l6";
            netModel.valueString = otherModel.l6;
        }
        
        
        
        [dataArray addObject:netModel];
    }
    return dataArray;
}


+ (NSMutableDictionary *)getFootBallDictionaryOfMatch:(NSMutableArray *)selectedArray{
    
    NSMutableDictionary *spfDictionary = [NSMutableDictionary dictionary];
    NSMutableArray *keysArray = [NSMutableArray array];
    for (ByNetModel *netModel in selectedArray) {
        if (![keysArray containsObject:netModel.ID]) {
            [keysArray addObject:netModel.ID];
        }
    }
    for (int i = 0; i < keysArray.count; i++) {
        NSString *key = [keysArray objectAtIndex:i];
        NSMutableArray *valusArray = [NSMutableArray arrayWithCapacity:1];
        [spfDictionary setObject:valusArray forKey:[NSString stringWithFormat:@"%@",key]];
    }
    
    for (ByNetModel *netModel in selectedArray) {
        NSMutableArray *rowArray = [spfDictionary objectForKey:netModel.ID];
        [rowArray addObject:netModel];
    }
    
    return spfDictionary;
    
}

//一场比赛只能选择一种投注类型
+ (BOOL)isOrNotClickWithSfData:(NSMutableArray *)sfArray rsfData:(NSMutableArray *)rsfArray bigSmallData:(NSMutableArray *)bigSmallArray sfcData:(NSMutableArray *)sfcArray WithType:(NSInteger )type WithIndexPath:(NSIndexPath *)indexPath{
    
    BOOL canClick = YES;
    NSMutableArray *sfSectionAry = [sfArray objectAtIndex:indexPath.section];
    NSMutableArray *rsfSectionAry = [rsfArray objectAtIndex:indexPath.section];
    NSMutableArray *bigSectionAry = [bigSmallArray objectAtIndex:indexPath.section];
    NSMutableArray *sfcSectionAry = [sfcArray objectAtIndex:indexPath.section];
    
    
    NSMutableArray *sfRowAry = [sfSectionAry objectAtIndex:indexPath.row];
    NSMutableArray *rsfRowAry= [rsfSectionAry objectAtIndex:indexPath.row];
    NSMutableArray *bigRowAry = [bigSectionAry objectAtIndex:indexPath.row];
    NSMutableArray *sfcSeRowAry = [sfcSectionAry objectAtIndex:indexPath.row];
    
    NSMutableArray *selectedArray1 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[sfRowAry copy]];
    NSMutableArray *selectedArray2 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[rsfRowAry copy]];
    NSMutableArray *selectedArray3 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[bigRowAry copy]];
    NSMutableArray *selectedArray4 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[sfcSeRowAry copy]];
   
    if (type == 1) {
        if (selectedArray2.count + selectedArray3.count + selectedArray4.count) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }else if (type == 2){
        if (selectedArray1.count + selectedArray3.count + selectedArray4.count) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }else if (type == 3){
        if (selectedArray1.count + selectedArray2.count + selectedArray4.count > 0) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }else if (type == 4){
        if (selectedArray1.count + selectedArray2.count + selectedArray3.count) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }
    return canClick;
    
    
}


+ (BOOL)isOrNotClickWithSfData:(NSMutableArray *)sfArray rsfData:(NSMutableArray *)rsfArray bigSmallData:(NSMutableArray *)bigSmallArray sfcData:(NSMutableArray *)sfcArray WithType:(NSInteger )type{
    
    BOOL canClick = YES;
    NSMutableArray *selectedArray1 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[sfArray copy]];
    NSMutableArray *selectedArray2 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[rsfArray copy]];
    NSMutableArray *selectedArray3 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[bigSmallArray copy]];
    NSMutableArray *selectedArray4 = [ByLotteryAlgorithmHandle getSelectedDataWithArray:[sfcArray copy]];
    

    if (type == 1) {
        if (selectedArray2.count + selectedArray3.count + selectedArray4.count) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }else if (type == 2){
        if (selectedArray1.count + selectedArray3.count + selectedArray4.count) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }else if (type == 3){
        if (selectedArray1.count + selectedArray2.count + selectedArray4.count > 0) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }else if (type == 4){
        if (selectedArray1.count + selectedArray2.count + selectedArray3.count) {
            [ByCoreToolAlert showOnlyText:@"混合过关一场比赛只能选择一种玩法"];
            return NO;
        }
    }
    return canClick;
}


+ (NSMutableDictionary *)getBasketBallGameResultWithPlan:(NSString *)plan{
    NSMutableDictionary *resultDic = [NSMutableDictionary  dictionaryWithCapacity:1];
    NSMutableDictionary *dic = [plan mutableObjectFromJSONString];
    NSArray *allKeys = [dic allKeys];
    for (int i = 0; i < allKeys.count; i++) {
        NSString *key  = [allKeys objectAtIndex:i];
        NSDictionary *sectionDic = [dic objectForKey:key];
        NSString *resultString = [ByBasketBallHandle getOneFootBallGameResultStingWithDictonary:sectionDic];
        [resultDic setObject:resultString forKey:key];
    }
    return resultDic;
}

+ (NSString *)getOneFootBallGameResultStingWithDictonary:(NSDictionary *)dic{
    NSString *resultSting = @"";
    NSArray *keys = [dic allKeys];
    NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
    for (NSString *key in keys) {
        NSLog(@"key = %@", key);
        //让胜负
        if (key.integerValue == 3002){
            NSDictionary *valueDic = [dic objectForKey:key];
            NSArray *valueKeys = [valueDic allKeys];
            for (NSString *value in valueKeys) {
                if (![value isEqualToString:@"single"] && ![value isEqualToString:@"fixedodds"]) {
                    if (value.integerValue == 3) {
                        [dataArray addObject:[NSString stringWithFormat:@"让主胜(%@)",valueDic[@"3"]]];
                    }else if (value.integerValue == 0){
                        [dataArray addObject:[NSString stringWithFormat:@"让主负(%@)",valueDic[@"0"]]];
                    }
                }
                
            }
        //胜负
        }else if (key.integerValue == 3001){
            NSDictionary *valueDic = [dic objectForKey:key];
            NSArray *valueKeys = [valueDic allKeys];
            for (NSString *value in valueKeys) {
                if (![value isEqualToString:@"single"]) {
                    if (value.integerValue == 3) {
                        [dataArray addObject:[NSString stringWithFormat:@"主胜(%@)",valueDic[@"3"]]];
                    }else if (value.integerValue == 0){
                        [dataArray addObject:[NSString stringWithFormat:@"主负(%@)",valueDic[@"0"]]];
                    }
                }
                
            }
            
        }
        
        //胜负差
        else if (key.integerValue == 3003){
            
           
            NSDictionary *valueDic = [dic objectForKey:key];
            NSArray *valueKeys = [valueDic allKeys];
            for (NSString *value in valueKeys) {
                if (![value isEqualToString:@"single"]) {
                    if ([value isEqualToString:@"w1"]) {
                        [dataArray addObject:[NSString stringWithFormat:@"主胜1-5(%@)",valueDic[@"w1"]]];
                    }else if ([value isEqualToString:@"w2"]){
                        [dataArray addObject:[NSString stringWithFormat:@"主胜6-10(%@)",valueDic[@"w2"]]];
                    }else if ([value isEqualToString:@"w3"]){
                        [dataArray addObject:[NSString stringWithFormat:@"主胜11-15(%@)",valueDic[@"w3"]]];
                    }else if ([value isEqualToString:@"w4"]){
                        [dataArray addObject:[NSString stringWithFormat:@"主胜16-20(%@)",valueDic[@"w4"]]];
                    }else if ([value isEqualToString:@"w5"]){
                        [dataArray addObject:[NSString stringWithFormat:@"主胜21-25(%@)",valueDic[@"w5"]]];
                    }else if ([value isEqualToString:@"w6"]){
                        [dataArray addObject:[NSString stringWithFormat:@"主胜26+(%@)",valueDic[@"w6"]]];
                    }else if ([value isEqualToString:@"l1"]){
                        [dataArray addObject:[NSString stringWithFormat:@"客胜1-5(%@)",valueDic[@"l1"]]];
                    }else if ([value isEqualToString:@"l2"]){
                        [dataArray addObject:[NSString stringWithFormat:@"客胜6-10(%@)",valueDic[@"l2"]]];
                    }else if ([value isEqualToString:@"l3"]){
                        [dataArray addObject:[NSString stringWithFormat:@"客胜11-15(%@)",valueDic[@"l3"]]];
                    }else if ([value isEqualToString:@"l4"]){
                        [dataArray addObject:[NSString stringWithFormat:@"客胜16-20(%@)",valueDic[@"l4"]]];
                    }else if ([value isEqualToString:@"l5"]){
                        [dataArray addObject:[NSString stringWithFormat:@"客胜21-25(%@)",valueDic[@"l5"]]];
                    }else if ([value isEqualToString:@"l6"]){
                        [dataArray addObject:[NSString stringWithFormat:@"客胜26+(%@)",valueDic[@"l6"]]];
                    }
                }
            }
        
        //大小分
        }else if (key.integerValue == 3004){
            
            NSDictionary *valueDic = [dic objectForKey:key];
            NSArray *valueKeys = [valueDic allKeys];
            for (NSString *value in valueKeys) {
                if (![value isEqualToString:@"single"] && ![value isEqualToString:@"score"]) {
                    if (value.integerValue == 1) {
                        [dataArray addObject:[NSString stringWithFormat:@"大分(%@)",valueDic[@"1"]]];
                    }else if (value.integerValue == 0){
                        [dataArray addObject:[NSString stringWithFormat:@"小分(%@)",valueDic[@"0"]]];
                    }
                }
                
                if ([value isEqualToString:@"score"]) {
                    [dataArray addObject:[NSString stringWithFormat:@"预设分(%@)",valueDic[@"score"]]];
                }
            }
            
        }
    }
    // 去重
    NSMutableArray *resultArray = [dataArray valueForKeyPath:@"@distinctUnionOfObjects.self"];
    if (resultArray.count > 1) {
        return [resultArray componentsJoinedByString:@","];
    }else if (resultArray.count == 1){
        return  [resultArray firstObject];
    }
    
    return  resultSting;
}


+ (NSString *)getGameResultStringWithSaiDic:(NSDictionary *)dic{
    
   
    return @"未开奖";
    
}


+ (NSString *)getBasketBallGameResultStringWithSaiDic:(NSDictionary *)dic {
    
    if ([dic isKindOfClass:[NSDictionary class]]){
        NSString *rq = dic[@"rq"];
        NSString *r = dic[@"r"];
        NSString *r_pv = dic[@"r.pv"];
        NSString *s_pv = dic[@"s.pv"];
        NSString *spf = dic[@"spf"];
        NSString *sfc = dic[@"sfc"];
        NSString *tot = [dic[@"tot"] stringValue];
        NSString *t_pv = dic[@"t.pv"];
        if ([s_pv isKindOfClass:[NSNull class]]) s_pv = @"-";
        
        NSString *value1 = [self getStringWithValue:spf Value:s_pv]; // 胜平负(赔率)
        NSString *value2 = [NSString stringWithFormat:@"让%@",[self getStringWithValue:r Value:r_pv]]; // 让球胜平负(赔率)

        NSString *winStr = @"";
        if ([sfc isEqualToString:@"l1"]) {
            winStr = [NSString stringWithFormat:@"客胜1-5"];
        } else if ([sfc isEqualToString:@"l2"]) {
            winStr = [NSString stringWithFormat:@"客胜6-10"];
        } else if ([sfc isEqualToString:@"l3"]) {
            winStr = [NSString stringWithFormat:@"客胜11-15"];
        } else if ([sfc isEqualToString:@"l4"]) {
            winStr = [NSString stringWithFormat:@"客胜16-20"];
        } else if ([sfc isEqualToString:@"l5"]) {
            winStr = [NSString stringWithFormat:@"客胜21-25"];
        } else if ([sfc isEqualToString:@"l6"]) {
            winStr = [NSString stringWithFormat:@"客胜26+"];
        } else if ([sfc isEqualToString:@"w1"]) {
            winStr = [NSString stringWithFormat:@"主胜1-5"];
        } else if ([sfc isEqualToString:@"w2"]) {
            winStr = [NSString stringWithFormat:@"主胜6-10"];
        } else if ([sfc isEqualToString:@"w3"]) {
            winStr = [NSString stringWithFormat:@"主胜11-15"];
        } else if ([sfc isEqualToString:@"w4"]) {
            winStr = [NSString stringWithFormat:@"主胜16-20"];
        } else if ([sfc isEqualToString:@"w5"]) {
            winStr = [NSString stringWithFormat:@"主胜21-25"];
        } else if ([sfc isEqualToString:@"w6"]) {
            winStr = [NSString stringWithFormat:@"主胜26+"];
        }

        
        NSString *totstr = @"";
        if (tot.integerValue == 1) {
            totstr = [NSString stringWithFormat:@"大分(%@)",t_pv];
        }else if (tot.integerValue == 0){
            totstr = [NSString stringWithFormat:@"小分(%@)",t_pv];
        }
        
        NSString *value4 = [NSString stringWithFormat:@"%@", totstr]; // 大小分
        NSString *value5 = [NSString stringWithFormat:@"%@", winStr]; // 多余进球区间
        return [NSString stringWithFormat:@"%@,%@,%@,%@",value1,value2,value4,value5];
        
    }
    return @"未开奖";
}

+ (NSString *)getSfcTitleWithSfc:(NSString *)sfc{
    
    NSString *winStr = @"";
    if ([sfc isEqualToString:@"l1"]) {
        winStr = [NSString stringWithFormat:@"客胜1-5"];
    } else if ([sfc isEqualToString:@"l2"]) {
        winStr = [NSString stringWithFormat:@"客胜6-10"];
    } else if ([sfc isEqualToString:@"l3"]) {
        winStr = [NSString stringWithFormat:@"客胜11-15"];
    } else if ([sfc isEqualToString:@"l4"]) {
        winStr = [NSString stringWithFormat:@"客胜16-20"];
    } else if ([sfc isEqualToString:@"l5"]) {
        winStr = [NSString stringWithFormat:@"客胜21-25"];
    } else if ([sfc isEqualToString:@"l6"]) {
        winStr = [NSString stringWithFormat:@"客胜26+"];
    } else if ([sfc isEqualToString:@"w1"]) {
        winStr = [NSString stringWithFormat:@"主胜1-5"];
    } else if ([sfc isEqualToString:@"w2"]) {
        winStr = [NSString stringWithFormat:@"主胜6-10"];
    } else if ([sfc isEqualToString:@"w3"]) {
        winStr = [NSString stringWithFormat:@"主胜11-15"];
    } else if ([sfc isEqualToString:@"w4"]) {
        winStr = [NSString stringWithFormat:@"主胜16-20"];
    } else if ([sfc isEqualToString:@"w5"]) {
        winStr = [NSString stringWithFormat:@"主胜21-25"];
    } else if ([sfc isEqualToString:@"w6"]) {
        winStr = [NSString stringWithFormat:@"主胜26+"];
    }
    return winStr;
}


+ (NSString *)getStringWithValue:(NSString *)value Value:(NSString *)value1{
    NSString *str;
    if (value.integerValue == 3) {
        str = @"主胜";
    }else if (value.integerValue == 1){
        str = @"平";
    }else if (value.integerValue == 0){
        str = @"主负";
    }
    NSString *string = [NSString stringWithFormat:@"%@(%@)", str,value1];
    return string;
}


+ (NSString *)getBasketBallGameWithSaiDicRq:(NSDictionary *)dic {
    if ([dic isKindOfClass:[NSDictionary class]]){
        NSString *rq = dic[@"rq"];
        return rq;
    }
    return @"";
}


//有单关
+ (BOOL)hasSingleWithArray:(NSMutableArray *)dataArray{
    
    for (ByNetModel *netModel in dataArray) {
        for (ByNetModel *model in netModel.sfSelectedArray) {
            if (model.single.integerValue > 0) {
                return YES;
            }
        }
        
        for (ByNetModel *model in netModel.rsfSelectedArray) {
            if (model.single.integerValue > 0) {
                return YES;
            }
        }
        
        for (ByNetModel *model in netModel.bigSmallSelectedArray) {
            if (model.single.integerValue > 0) {
                return YES;
            }
        }
        
        for (ByNetModel *model in netModel.sfcSelectedArray) {
            if (model.single.integerValue > 0) {
                return YES;
            }
        }
        
    }
    return NO;
}


//得到篮球，跟单开奖结果
+ (NSString *)getDocumentaryBasketBallResultWithDic:(NSDictionary *)dic{
    //HDC  让分胜负
    //HILO  大小分
    //MNL   胜负
    //WNM  胜负差
    if ([dic isKindOfClass:[NSDictionary class]]) {
        NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:1];
        NSString *HDC = dic[@"HDC"];
        NSString *HILO = dic[@"HILO"];
        NSString *MNL = dic[@"MNL"];
        NSString *WNM = dic[@"WNM"];
        
        if (HILO) {
            if (HILO.integerValue == 0) {
                [dataArray addObject:@"小分"];
            }else{
                [dataArray addObject:@"大分"];
            }
        }
        
        if (HDC) {
            if (HDC.integerValue == 0) {
                [dataArray addObject:@"让客胜"];
            }else{
                [dataArray addObject:@"让主胜"];
            }
        }
        
        if (MNL) {
            if (MNL.integerValue == 0) {
                 [dataArray addObject:@"客胜"];
            }else{
                 [dataArray addObject:@"主胜"];
            }
        }
        
        if (WNM) {
            [dataArray addObject:[self getSfcTitleWithSfc:WNM]];
        }
        
       return [dataArray componentsJoinedByString:@","];
        
    }else{
        return @"未开奖";
    }
    
    
}

@end
